#ifndef MYCIRCLE_H
#define MYCIRCLE_H

#include <QGraphicsItem>

class MyCircle : public QObject,public QGraphicsItem
{
    Q_OBJECT
public:
    MyCircle();
    MyCircle(QPointF pt1,QPointF pt2);
    QPointF mCenPt;
    qreal mRad;

    void DrawSnapRect(QPainter *painter, QPointF cpt);

    int Snaped(QPointF spt);    // 设计一个捕捉特征点的函数，返回值为1-5分别代表捕捉到了哪个点
    // QGraphicsItem interface
public:
    QRectF boundingRect() const override;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;

protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;

    // QGraphicsItem interface
public:
    QPainterPath shape() const override;

};

#endif // MYCIRCLE_H
